
#ifndef SERVERMOON_H
#define SERVERMOON_H

#include <cstdlib>
#include <string>
#include "ResearchTask.h"
#include "ProductionTask.h"
#include "Missile.h"
#include "Shield.h"
using namespace std;

class ServerMoon {
	public:
		const static int PRODUCTION_DO_NOTHING = 0;
		const static int PRODUCTION_MISSILE = 1;
		const static int PRODUCTION_SHIELD = 2;
		const static int RESEARCH_DO_NOTHING = 0;
		const static int RESEARCH_MISSILE = 1;
		const static int RESEARCH_SHIELD = 2;

		ServerMoon(int pMoonId, int pStartingPopulation);
		//assign to a player
		void assign(int pPlayerId);
		int getPlayerId();
		int getMoonId();
		//getters and setters
		int getPopulation();
		void setPopulation(int newPopulation);
		//get the name of the current task, for display
		string getCurrentProductionTaskName();
		string getCurrentResearchTaskName();
		//tasks
		void startBuild(int task, int level);
		void startResearch(int task, int level);
		//returns the progress of the tasks 0-100, -1 if no task
		int getBuildProgress();
		int getResearchProgress();
		//update method
		void update(int numSteps);

		//population allocation methods
		void allocatePopulation(int pReproduction, int pResearch, int pProduction);
		int getReproduction();
		int getProduction();
		int getResearch();

		int getMissileResearchLevel();
		int getShieldResearchLevel();

		Missile * getReadyMissile();
		Shield * getReadyShield();
	private:
		//planet attributes
		int moonId;
		double population;
		int playerId;

		//how much time is left for the tasks to finish
		ResearchTask * currentResearchTask;
		ProductionTask * currentProductionTask;

		//the missile that is ready to fire
		Missile * readyMissile;
		
		//the shield protecting the planet
		Shield * readyShield;

		//research levels, start at 1
		int missileResearchLevel;
		int shieldResearchLevel;

		//population allocations - add up to 100
		int reproduction;
		int production;
		int research;
};

#endif